import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
    {
        path: "/author",
        name: "author",
        component: () => import("../views/authorDing.vue")
    },
    {
        path: "/",
        name: "Home",
        component: Home,
        meta: {
            keepAlive: true
        }
    },
    {
        path: "/officeArchives",
        name: "officeArchives",
        component: () => import("../views/officeArch.vue"),
        meta: {
            keepAlive: true
        }
    },
    {
        path: "/personnelArchives",
        name: "personnelArch",
        component: () => import("../views/personnelArch.vue"),
        meta: {
            keepAlive: true
        }
    }, {
        path: "/projectArchives",
        name: "projectArch",
        component: () => import("../views/projectArch.vue"),
        meta: {
            keepAlive: true
        }
    },
    {
        path: "/record",
        name: "record",
        component: () => import("../views/record.vue")
    },
    {
        path: "/repair",
        name: "repair",
        component: () => import("../views/repair.vue")
    },
    {
        path: "/repairRecord",
        name: "repairRecord",
        component: () => import("../views/repairRecord.vue")
    },
    {
        path: "/selectProject",
        name: "selectProject",
        component: () => import("../views/selectProject.vue")
    },
    {
        path: "/officeFillRecord",
        name: "officeFillRecord",
        component: () => import("../views/record/officeFillRecord.vue")
    },
    {
        path: "/personFillRecord",
        name: "personFillRecord",
        component: () => import("../views/record/personFillRecord.vue")
    },
    {
        path: "/projectFillRecord",
        name: "projectFillRecord",
        component: () => import("../views/record/projectFillRecord.vue")
    },
    {
        path: "/sysModifyData",
        name: "sysModifyData",
        component: () => import("../views/sysModifyData.vue")
    },
    {
        path:'/managerModifyData',
        name:'managerModifyData',
        component: () => import("../views/managerModifyData.vue")
    }
];

const router = new VueRouter({
    routes
});
router.beforeEach((to,from,next)=>{
    next()
    // if (to.name=='author'){
    //     if (localStorage.getItem("sessionId")){
    //         next("/")
    //     }else {
    //         next()
    //     }
    // }else {
    //     if (localStorage.getItem("sessionId")){
    //         next()
    //     }else {
    //         next('author')
    //     }
    // }
})
export default router;
